package com.ruoyi.common.core.domain.entity;

import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceReservation extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private Long userId;
    private Long id;
    private Long providerId;
    private Long serviceTypeId;  // 新增字段，数据库对应列

    private ServiceType serviceType; // 服务类型实体类
    private LocalDate reservationDate; // 日期类型（对应数据库 DATE）
    private LocalTime reservationTime; // 时间类型（对应数据库 TIME）
    private String contactName;
    private String contactPhone;
    private String remark;
    private String status;
    // 继承自 BaseEntity 的 createBy、createTime、updateBy、updateTime 保持 Date 类型
    // 手动写 setter，保证serviceTypeId正确赋值
    public void setServiceType(ServiceType serviceType) {
        this.serviceType = serviceType;
        if (serviceType != null) {
            this.serviceTypeId = serviceType.getId();
        }
    }
}